package cn.com.cabinet.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Service;

import com.cabinet.web.entity.CabinetApplication;

import cn.com.cabinet.dao.CabinetApplicationDao;

@Service
public class CabinetApplicationServiceImpl {
	
	@Autowired
	private CabinetApplicationDao cabinetApplicationDao;

	
	/**
	 * 通过申请状态获取申请列表
	 * @param page
	 * @param limit
	 * @return
	 */
	public List<CabinetApplication> getCabinetApplicationByMark(Integer applicationMark,Integer page,Integer limit){
		return cabinetApplicationDao.getCabinetApplicationByMark(applicationMark, page, limit);
		
	}
	
	
	/**
	 * 通过申请状态获取申请总数
	 * @param applicationMark
	 * @return
	 */
	public int getCabinetApplicationCountByMark(Integer applicationMark){
		return cabinetApplicationDao.getCabinetApplicationCountByMark(applicationMark);
		
	}
	
	public CabinetApplication getCabinetApplication(Long id){
		return cabinetApplicationDao.findOne(id);
		
	}
	
	public void saveorUpdateCabinetApplication(CabinetApplication c){
		cabinetApplicationDao.save(c);
		
	}
	
}
